using System.Collections.Generic;
using System.Linq;

namespace Components
{
    public class PageableWrapper<TItem> : PageableBase<TItem>
    {
        public ICollection<TItem> Data { get; private set; }        


        public PageableWrapper(IEnumerable<TItem> data)
        {
            Data = (data as ICollection<TItem>) ?? data.ToList();
        }

        public override int Count
        {
            get { return Data.Count; }
        }

        public override IEnumerable<TItem> GetAll()
        {
            return Data;
        }

        public override IEnumerable<TItem> GetPage(int offset, int count)
        {
            return Data.Skip(offset).Take(count);
        }        
    }
}